//基于链接数最少的策略
const assign2server = (workpools) => {
    let flag = '';
    let min = Infinity;
    Object.keys(workpools).forEach(key => {
        const value = workpools[key];
        if(value){
            if (value.conns < min) {
                min = value.conns;
                flag = key;
            }
        }
    })
    workpools[flag]  && workpools[flag].conns++;
    return flag;
}

module.exports = {
    assign2server
};